import React from 'react';
import { Link } from 'react-router-dom';
import { SimpleLink } from '../wangTypes/index';

const TopBar: React.FC = () => {
  const links: SimpleLink[] = [
    { text: '登录', url: '#' },
    { text: '注册', url: '#' },
    { text: '我的订单', url: '#' },
    { text: '客户服务', url: '/customerService' }
  ];

  return (
    <div className="top-bar">
      <div className="container">
        <div className="left">
          <span>欢迎来到智电馆</span>
        </div>
        <div className="right">
          {links.map((link, index) => (
            link.url.startsWith('#') ? 
              <a key={index} href={link.url}>{link.text}</a> :
              <Link key={index} to={link.url}>{link.text}</Link>
          ))}
        </div>
      </div>
    </div>
  );
};

export default TopBar;